#include <iostream>
#include <unistd.h>
#include <memory>
#include "TCP_server.hpp"

static void Usage(const char* str)
{
    std::cout << "\n Usage:" << str << " port\n" << std::endl; 
}

// ./TCP_server port
int main(int argc, char* argv[])
{
    if(argc != 2)
    {
        Usage(argv[1]);
        exit(1);
    }
    
    std::unique_ptr<TCP_server> server(new TCP_server(atoi(argv[1])));
    server->serverinit();
    server->start();

    return 0;
}